import request from '@/utils/request.js'

export const getChannels = () => {
  // 如果函数没有写return，
  //  它有一个默认的return值，就是undefined
  // return request({
  return request({
    url: 'v1_0/user/channels', // 接口地址
    method: 'GET'
  })
}

/**
 * 获取系统中所有的频道
 */
export const getAllChannels = () => {
  return request({
    method: 'GET',
    url: 'v1_0/channels'
  })
}


export const addChannels = (channels) => {
  return request({
    url: '/v1_0/user/channels', // 接口地址
    method: 'PATCH',
    data: {
      channels
    }
  })
}

/**
 * 频道删除
 * @param {*} channelId 要删除的频道id
 * @returns
 */
export const delChannel = (channelId) => {
  return request({
    url: '/v1_0/user/channels/' + channelId,
    method: 'DELETE'
  })
}
